package com.homedo.odin.solution.service;

import com.homedo.core.common.base.service.BaseService;
import com.homedo.odin.solution.dao.UserBasicMapper;
import com.homedo.odin.solution.dao.UserProfileMapper;
import com.homedo.odin.solution.model.entity.UserBasic;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * <p> 用户基本信息表 服务实现类 </p>
 *
 * @author HarveyDing
 * @since 2018-03-08
 */
@Service
public class UserBasicServiceImpl extends BaseService<UserBasicMapper, UserBasic> {

    @Resource
    UserProfileMapper userProfileMapper;

    /**
     * 根据用户id查找个人资料
     */
    public UserBasic selectByUserId(Integer userId) {
        UserBasic userBasic = new UserBasic();
        userBasic.setUserId(userId);
        UserBasic basic = baseMapper.selectOne(userBasic);
        return basic;
    }

    public UserBasic getUserBasicInfo(Integer userId) {
        UserBasic userBasic = new UserBasic();
        userBasic.setUserId(userId);
        userBasic = baseMapper.selectOne(userBasic);
        return userBasic;
    }

    public void updateUserBasic(UserBasic userBasic) {
        baseMapper.updateById(userBasic);
    }

    public void insertUserBasic(UserBasic transfrom) {
        baseMapper.insert(transfrom);
    }
}
